package cn.hnwlgc.controller;

import cn.hnwlgc.pojo.Result;
import cn.hnwlgc.pojo.Tag;
import cn.hnwlgc.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/tag")
public class TagController {

    @Autowired
    private TagService tagService;

    @GetMapping
    public Result list(){
        List<Tag> tagList=tagService.list();
        return Result.success(tagList);
    }

    @GetMapping("/{id}")
    public Result getById(@PathVariable Integer id){
        Tag tag=tagService.getById(id);
        return Result.success(tag);
    }
}
